RangeMap

RangeMap allows specifying a range in which a value spams, quite useful for defining outcomes based on an input, experience gain progression, etc. Example Usage:

RangeMap!(int, string) colorRanges = "White"; //Default is "White"
colorRanges[0..9] = "Red";
colorRanges[10..19] = "Green";
colorRanges[20..29] = "Blue"

writeln(colorRanges[5]); //Prints "Red"

Members

Functions

get
V get(K value)

Uses binary search for finding the value range.

opAssign
auto ref opAssign(V value)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
V opIndex(K index)
Undocumented in source. Be warned that the author may not have intended to support it.
opSliceAssign
V opSliceAssign(V value, K start, K end)
Undocumented in source. Be warned that the author may not have intended to support it.
setDefault
RangeMap setDefault(V _default)

When the value is out of range, the value returned is the _default one.

setRange
RangeMap setRange(K a, K b, V value)

Alternative to the slice syntax

Variables

_default
V _default;
Undocumented in source.
ranges
Array!K ranges;
Undocumented in source.
values
Array!V values;
Undocumented in source.

Meta